package com.hzw.net.delegate

import androidx.viewbinding.ViewBinding
import com.hzw.net.page.layout.AbsTitleLayout

/**
 *
 * @Author:         HuaZhongWei
 * @CreateDate:     2020/12/1 10:18
 *
 * @Description:
 *
 */

private class TitleViewBindingProperty<A : AbsTitleLayout, T : ViewBinding>(
    viewBinder: (A) -> T
) : ViewBindingProperty<A, T>(viewBinder) {
    override fun getLifecycleOwner(thisRef: A) = thisRef.owner
}

@JvmName("viewBindingTitle")
public fun <A : AbsTitleLayout, T : ViewBinding> AbsTitleLayout.viewBinding(
    viewBinder: (A) -> T
): ViewBindingProperty<A, T> {
    return TitleViewBindingProperty(viewBinder)
}